package com.googlecode.microanalyst.designer.model.property;

import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.ui.views.properties.IPropertySource;

import com.googlecode.microanalyst.designer.i18n.DesignerMessages;
import com.googlecode.microanalyst.designer.model.AnalysisElement;

public class BasePropertyHandler<T extends AnalysisElement> extends
		PropertySupport<T> implements PropertyHandler {

	public BasePropertyHandler(T subject) {
		super(subject);
	}

	protected void addSizeProperty() {
		addProperty("size", DesignerMessages.PropertyDescriptor_Tool_Size,
				new PropertySourceFactory() {
					public IPropertySource create(Object value) {
						return new DimensionPropertySource((Dimension) value);
					}
				});
	}

	protected void addLocationProperty() {
		addProperty("location",
				DesignerMessages.PropertyDescriptor_Tool_Location,
				new PropertySourceFactory() {
					public IPropertySource create(Object value) {
						return new LocationPropertySource((Point) value);
					}
				});
	}
}
